﻿using System.Collections.Generic;

public class Course:IExamResults
{
    private HashSet<int> visitingStudents;

    public int StudentsCount 
    {
        get 
        {
            return visitingStudents.Count;
        }
    }

    public Course()
    {
        visitingStudents = new HashSet<int>();
    }

    public bool JoinCourse(int studentFN)
    {
        if (visitingStudents.Count >= 30)
        {
            return false;
        }
        if (visitingStudents.Contains(studentFN))
        {
            return false;
        }
        
        visitingStudents.Add(studentFN);
        return true;
    }

    public bool LeaveCourse(int fn)
    {
        return visitingStudents.Remove(fn);
    }
}

